<template>
  <div class="container">
    <el-card class="info">
      <el-tabs v-model="activeName" @tab-click="handleClick">
        <el-tab-pane name="first" label="基础配置">
          <el-form ref="formData" label-position="left" label-width="140px" size="mini" class="mt20" label-suffix="：">
            <div class="title">微信小程序</div>
            <el-form-item label="客服功能">
              <el-radio-group v-model="formData.mini_kefu">
                <el-radio label="0">关闭</el-radio>
                <el-radio label="1">开启</el-radio>
              </el-radio-group>
            </el-form-item>
            <div class="title">企业微信</div>
            <el-form-item label="微信审批">
              <el-radio-group v-model="formData.qwx_approve">
                <el-radio label="0">关闭</el-radio>
                <el-radio label="1">开启</el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item label="消息推送">
              <el-radio-group v-model="formData.qwx_message_push">
                <el-radio label="0">关闭</el-radio>
                <el-radio label="1">开启</el-radio>
              </el-radio-group>
            </el-form-item>
            <div class="title">金蝶资料</div>
            <el-form-item label="金蝶资料">
              <el-radio-group v-model="formData.kd">
                <el-radio label="0">关闭</el-radio>
                <el-radio label="1">开启</el-radio>
              </el-radio-group>
            </el-form-item>
            <div v-if="formData.kd != 0" class="pl160">
              <div class="titleQ">
                <span>.</span>
                产品资料
              </div>
              <el-form-item label="产品资料" class="ml10">
                <el-radio-group v-model="formData.kd_pt">
                  <el-radio label="0">关闭</el-radio>
                  <el-radio label="1">同步商品</el-radio>
                  <el-radio label="2">金蝶对码</el-radio>
                </el-radio-group>
              </el-form-item>
            </div>
            <div v-if="formData.kd != 0 && formData.kd_pt != 0" class="pl320">
              <div class="titleQ titleQ2">
                <span class="spanS">.</span>
                仓库对码
              </div>
              <el-form-item label="仓库对码" class="ml10">
                <el-radio-group v-model="formData.kd_pt_match_code">
                  <el-radio label="0">通用账套</el-radio>
                  <el-radio label="1">多账套</el-radio>
                </el-radio-group>
              </el-form-item>
            </div>
            <div v-if="formData.kd != 0" class="pl160">
              <div class="titleQ">
                <span>.</span>
                餐饮直销
              </div>
              <el-form-item label="客户资料" class="ml10">
                <el-radio-group v-model="formData.kd_ct">
                  <el-radio label="0">关闭</el-radio>
                  <el-radio label="1">CRM推送</el-radio>
                  <el-radio label="2">金蝶对码</el-radio>
                </el-radio-group>
              </el-form-item>
            </div>
            <div v-if="formData.kd != 0 && formData.kd_ct != 0" class="pl320">
              <div class="titleQ titleQ2">
                <span class="spanS">.</span>
                订单推送
              </div>
              <el-form-item label="订单推送" class="ml10">
                <el-radio-group v-model="formData.kd_ct_order_push">
                  <el-radio label="0">关闭</el-radio>
                  <el-radio label="1">开启</el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item v-if="formData.kd_ct_order_push == 1" label="下推规则" class="ml50">
                <el-radio-group v-model="formData.kd_ct_order_push_rule">
                  <el-radio label="0">创建金蝶销售订单</el-radio>
                  <el-radio label="1">创建并下推至金蝶发货通知单</el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item v-if="formData.kd_ct_order_push == 1" label="下推方式" class="ml50">
                <el-radio-group v-model="formData.kd_ct_order_push_mode">
                  <el-radio label="0">自动下推</el-radio>
                  <el-radio label="1">人工下推</el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item v-if="formData.kd_ct_order_push == 1" label="库存校验" class="ml50">
                <el-radio-group v-model="formData.kd_ct_order_push_verify_ity">
                  <el-radio label="0">不校验库存</el-radio>
                  <el-radio label="1">校验库存</el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item label="挂账周期" class="ml10">
                <el-radio-group v-model="formData.kd_ct_payment_cycle">
                  <el-radio label="0">关闭</el-radio>
                  <el-radio label="1">开启</el-radio>
                </el-radio-group>
              </el-form-item>
            </div>
            <div v-if="formData.kd != 0" class="pl160">
              <div class="titleQ">
                <span>.</span>
                经销商
              </div>
              <el-form-item label="客户资料" class="ml10">
                <el-radio-group v-model="formData.kd_dl">
                  <el-radio label="0">关闭</el-radio>
                  <el-radio label="1">CRM推送</el-radio>
                  <el-radio label="2">金蝶对码</el-radio>
                </el-radio-group>
              </el-form-item>
            </div>
            <div v-if="formData.kd != 0 && formData.kd_dl != 0" class="pl320">
              <!-- <div class="titleQ titleQ2">
            <span class="spanS">.</span>
            订单推送
          </div> -->
              <el-form-item label="订单推送" class="ml10">
                <el-radio-group v-model="formData.kd_dl_order_push">
                  <el-radio label="0">关闭</el-radio>
                  <el-radio label="1">开启</el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item v-if="formData.kd_dl_order_push == 1" label="下推规则" class="ml50">
                <el-radio-group v-model="formData.kd_dl_order_push_rule">
                  <el-radio label="0">创建金蝶销售订单</el-radio>
                  <el-radio label="1">创建并下推至金蝶发货通知单</el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item v-if="formData.kd_dl_order_push == 1" label="下推方式" class="ml50">
                <el-radio-group v-model="formData.kd_dl_order_push_mode">
                  <el-radio label="0">自动下推</el-radio>
                  <el-radio label="1">人工下推</el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item v-if="formData.kd_dl_order_push == 1" label="库存校验" class="ml50">
                <el-radio-group v-model="formData.kd_dl_order_push_verify_ity">
                  <el-radio label="0">不校验库存</el-radio>
                  <el-radio label="1">校验库存</el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item label="挂账周期" class="ml10">
                <el-radio-group v-model="formData.kd_dl_payment_cycle">
                  <el-radio label="0">关闭</el-radio>
                  <el-radio label="1">开启</el-radio>
                </el-radio-group>
              </el-form-item>
            </div>
            <div class="title">产品信息</div>
            <el-form-item label="产品信息">
              <el-radio-group v-model="formData.pt">
                <el-radio label="0">关闭</el-radio>
                <el-radio label="1">直销</el-radio>
                <el-radio label="2">经销</el-radio>
                <el-radio label="3">直销和经销</el-radio>
              </el-radio-group>
            </el-form-item>
            <div v-if="formData.pt != 0 && formData.pt != 2" class="pl160">
              <div class="titleQ">
                <span>.</span>
                餐饮直销
              </div>
              <el-form-item label="调价" class="ml10">
                <el-radio-group v-model="formData.pt_ct_pricing">
                  <el-radio label="0">关闭</el-radio>
                  <el-radio label="1">开启</el-radio>
                </el-radio-group>
              </el-form-item>
              <div v-if="formData.pt_ct_pricing == '1'" class="pl160">
                <!-- <div class="titleQ titleQ2">
              <span class="spanS">.</span>
              客户成交规则
            </div> -->
                <el-form-item label="客户成交规则" class="ml10">
                  <el-radio-group v-model="formData.pt_ct_pricing_rule">
                    <el-radio label="0">不校验调价</el-radio>
                    <el-radio label="1">手动创建后可成交</el-radio>
                    <el-radio label="2">自动创建后成交</el-radio>
                  </el-radio-group>
                </el-form-item>
                <div class="pl50">
                  <el-form-item v-if="formData.pt_ct_pricing_rule == 2" label="商品范围" class="ml10">
                    <el-radio-group v-model="pt_ct_pricing_rule_range" @change="changePTCT">
                      <el-radio label="0">全部</el-radio>
                      <el-radio label="1">自选商品</el-radio>
                    </el-radio-group>
                  </el-form-item>
                  <el-input
                    v-if="
                      formData.pt_ct_pricing_rule == 2 &&
                        pt_ct_pricing_rule_range == 1
                    "
                    v-model="formData.pt_ct_pricing_rule_range"
                    type="textarea"
                    placeholder="请填写商品id，多个请用“ ，”隔开"
                    class="w600 mb30"
                  />
                </div>
              </div>
              <el-form-item label="小程序显示规则" class="ml10">
                <el-radio-group v-model="formData.pt_ct_mini">
                  <el-radio label="0">显示所有</el-radio>
                  <el-radio label="1">仅显示调价</el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item label="订单" class="ml10">
                <el-radio-group v-model="formData.pt_ct_order">
                  <el-radio label="0">关闭</el-radio>
                  <el-radio label="1">开启</el-radio>
                </el-radio-group>
              </el-form-item>
              <div v-if="formData.pt_ct_order == 1" class="pl50">
                <el-form-item label="货到付款" class="ml10">
                  <el-radio-group v-model="formData.pt_ct_order_cash_delivery">
                    <el-radio label="0">关闭</el-radio>
                    <el-radio label="1">开启-客户需要申请货到付款功能</el-radio>
                    <el-radio label="2">开启-客户自动拥有货到付款功能</el-radio>
                  </el-radio-group>
                </el-form-item>
              </div>
              <el-form-item label="试样" class="ml10">
                <el-radio-group v-model="formData.pt_ct_sample">
                  <el-radio label="0">不使用发货工厂</el-radio>
                  <el-radio label="1">使用发货工厂</el-radio>
                </el-radio-group>
              </el-form-item>
            </div>
            <div v-if="formData.pt != 0 && formData.pt != 1" class="pl160">
              <div class="titleQ">
                <span>.</span>
                经销商
              </div>
              <el-form-item label="调价" class="ml10">
                <el-radio-group v-model="formData.pt_dl_pricing">
                  <el-radio label="0">关闭</el-radio>
                  <el-radio label="1">开启</el-radio>
                </el-radio-group>
              </el-form-item>
              <div v-if="formData.pt_dl_pricing == '1'" class="pl160">
                <!-- <div class="titleQ titleQ2">
              <span class="spanS">.</span>
              客户成交规则
            </div> -->
                <el-form-item label="客户成交规则" class="ml10">
                  <el-radio-group v-model="formData.pt_dl_pricing_rule">
                    <el-radio label="0">不校验调价</el-radio>
                    <el-radio label="1">手动创建后可成交</el-radio>
                    <el-radio label="2">自动创建后成交</el-radio>
                  </el-radio-group>
                </el-form-item>
                <div class="pl50">
                  <el-form-item v-if="formData.pt_dl_pricing_rule == 2" label="商品范围" class="ml10">
                    <el-radio-group v-model="pt_dl_pricing_rule_range" @change="changePTDL">
                      <el-radio label="0">全部</el-radio>
                      <el-radio label="1">自选商品</el-radio>
                    </el-radio-group>
                  </el-form-item>
                  <el-input
                    v-if="
                      formData.pt_dl_pricing_rule == 2 &&
                        pt_dl_pricing_rule_range == 1
                    "
                    v-model="formData.pt_dl_pricing_rule_range"
                    type="textarea"
                    placeholder="请填写商品id，多个请用“ ，”隔开"
                    class="w600 mb30"
                  />
                </div>
              </div>
              <el-form-item label="小程序显示规则" class="ml10">
                <el-radio-group v-model="formData.pt_dl_mini">
                  <el-radio label="0">显示所有</el-radio>
                  <el-radio label="1">仅显示调价</el-radio>
                </el-radio-group>
              </el-form-item>
              <!-- <el-form-item label="试样" class="ml10">
            <el-radio-group v-model="formData.pt_dl_sample">
              <el-radio label="0">关闭</el-radio>
              <el-radio label="1">开启</el-radio>
            </el-radio-group>
          </el-form-item> -->
              <el-form-item label="订单" class="ml10">
                <el-radio-group v-model="formData.pt_dl_order">
                  <el-radio label="0">关闭</el-radio>
                  <el-radio label="1">开启</el-radio>
                </el-radio-group>
              </el-form-item>
              <div v-if="formData.pt_dl_order == 1" class="pl50">
                <el-form-item label="货到付款" class="ml10">
                  <el-radio-group v-model="formData.pt_dl_order_cash_delivery">
                    <el-radio label="0">关闭</el-radio>
                    <el-radio label="1">开启-申请认证</el-radio>
                    <el-radio label="2">开启-自动认证</el-radio>
                  </el-radio-group>
                </el-form-item>
              </div>
            </div>
            <div class="title">餐饮直销</div>
            <el-form-item label="餐饮直销">
              <el-radio-group v-model="formData.ct">
                <el-radio label="0">关闭</el-radio>
                <el-radio label="1">开启</el-radio>
              </el-radio-group>
            </el-form-item>
            <div v-if="formData.ct != 0" class="pl160">
              <el-form-item label="共享同步">
                <el-radio-group v-model="formData.ct_share_sync">
                  <el-radio label="0">关闭</el-radio>
                  <el-radio label="1">开启</el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item label="共享推送">
                <el-radio-group v-model="formData.ct_share_push">
                  <el-radio label="0">关闭</el-radio>
                  <el-radio label="1">开启</el-radio>
                </el-radio-group>
              </el-form-item>
            </div>
            <div class="title">经销商</div>
            <el-form-item label="经销商">
              <el-radio-group v-model="formData.dl">
                <el-radio label="0">关闭</el-radio>
                <el-radio label="1">开启</el-radio>
              </el-radio-group>
            </el-form-item>
            <div v-if="formData.dl != 0" class="pl160">
              <el-form-item label="共享同步">
                <el-radio-group v-model="formData.dl_share_sync">
                  <el-radio label="0">关闭</el-radio>
                  <el-radio label="1">开启</el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item label="共享推送">
                <el-radio-group v-model="formData.dl_share_push">
                  <el-radio label="0">关闭</el-radio>
                  <el-radio label="1">开启</el-radio>
                </el-radio-group>
              </el-form-item>
            </div>
          </el-form>
          <div class="dialog-footer">
            <el-button type="primary" size="small" @click="hint('add', '更新配置信息')">更新配置信息</el-button>
            <el-button type="primary" size="small" plain @click="hint('update', '更新超级管理权限')">更新超管权限</el-button>
          </div>
        </el-tab-pane>
        <el-tab-pane name="second" label="区域管理">
          <el-table
            v-loading="loading"
            border
            :data="list"
            size="small"
            row-key="id"
            :lazy="true"
            :load="load"
            :tree-props="{ children: 'children', hasChildren: 'children' }"
            :header-cell-style="$style.rowClass"
          >
            <el-table-column prop="name" label="地区名称" />
            <el-table-column prop="level" label="所在层级" align="center" />
            <el-table-column prop="code" label="行政编码" align="center" />
            <el-table-column label="操作" width="160" align="center">
              <template slot-scope="{ row }">
                <el-button size="mini" type="text" @click="tapBtn('编辑', row)">编 辑</el-button>
                <el-button v-if="row.level != 3" size="mini" type="text" @click="tapBtn('添加', row)">添加下级</el-button>
              </template>
            </el-table-column>
          </el-table>
        </el-tab-pane>
        <el-tab-pane name="third" label="公共字典">
          <!--检索条件-->
          <el-form class="row" :inline="true" label-suffix="：" size="mini" :model="search">
            <div>
              <el-form-item label="名称">
                <el-input v-model="search.name" placeholder="请输入名称" class="w160" clearable />
              </el-form-item>
              <el-form-item label="所属类型">
                <el-select v-model="search.type" class="w160" clearable placeholder="请选择状态">
                  <el-option v-for="item in options.type" :key="item.id" :label="item.name" :value="item.id" />
                </el-select>
              </el-form-item>
            </div>
            <div>
              <el-form-item>
                <el-button type="primary" @click="getdictList('search')">搜 索</el-button>
                <el-button size="mini" type="primary" @click="openDialog('添加')">添 加</el-button>
              </el-form-item>
            </div>
          </el-form>
          <el-table
            :data="dictList"
            size="small"
            row-key="id"
            height="640"
            default-expand-all
            :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
            :cell-style="$style.cellStyle"
            :header-cell-style="$style.rowClass"
          >
            <ElTableColumn label="名称" prop="name" />
            <ElTableColumn label="所属类型" prop="type_name" width="120" />
            <ElTableColumn label="上级关系" prop="pid_name" width="120" />
            <ElTableColumn label="备注" prop="remark" />
            <ElTableColumn label="创建时间" prop="create_time" width="140" />
            <ElTableColumn label="更新时间" prop="update_time" width="140" />
            <ElTableColumn label="状态" prop="status_name" width="80" />
            <ElTableColumn label="操作" width="100">
              <template slot-scope="{ row }">
                <el-button size="mini" type="primary" @click="openDialog('编辑', row)">编 辑</el-button>
              </template>
            </ElTableColumn>
          </el-table>
        </el-tab-pane>
        <el-tab-pane name="fourth" label="Android版本">
          <el-form ref="ruleForm" label-position="left" label-width="220px" :rules="fourthRules" :model="ruleForm">
            <el-form-item class="pl10" label="APP关闭状态:" size="mini">
              <span class="mr10">关</span>
              <el-switch v-model="swichStatus" @change="changeSwichStatus" />
              <span class="ml10">开</span>
            </el-form-item>
            <el-form-item v-if="swichStatus" label="关闭原因:" prop="app_close_reason" size="mini">
              <el-input v-model="ruleForm.app_close_reason" class="w300" type="textarea" />
            </el-form-item>
            <el-form-item class="pl10" label="强制更新:" size="mini">
              <span class="mr10">关</span>
              <el-switch v-model="swich" @change="changeSwich" />
              <span class="ml10">开</span>
            </el-form-item>
            <el-form-item label="安卓版本:" prop="app_version" size="mini">
              <el-input v-model="ruleForm.app_version" class="w300" />
            </el-form-item>
            <el-form-item label="安卓下载地址:" prop="app_path" size="mini">
              <el-input v-model="ruleForm.app_path" class="w300" />
            </el-form-item>
            <el-form-item label="安卓更新日志:" prop="app_log" size="mini">
              <el-input v-model="ruleForm.app_log" class="w300" type="textarea" />
            </el-form-item>
          </el-form>
          <div class="tr mt80">
            <el-button size="small" @click="quitSlide('ruleForm')">重置</el-button>
            <el-button size="small" type="primary" @click="submitFormFourth('ruleForm')">保存</el-button>
          </div>
        </el-tab-pane>
        <el-tab-pane name="fifth" label="ios版本">
          <el-form ref="ruleFormIos" label-position="left" label-width="220px" :rules="rules" :model="ruleFormIos">
            <el-form-item class="pl10" label="APP关闭状态:" size="mini">
              <span class="mr10">关</span>
              <el-switch v-model="swichStatusIos" @change="changeSwichStatusIos" />
              <span class="ml10">开</span>
            </el-form-item>
            <el-form-item v-if="swichStatusIos" label="关闭原因:" prop="app_close_reason" size="mini">
              <el-input v-model="ruleFormIos.app_close_reason" class="w300" type="textarea" />
            </el-form-item>
            <el-form-item class="pl10" label="强制更新:" size="mini">
              <span class="mr10">关</span>
              <el-switch v-model="swichIos" @change="changeSwichIos" />
              <span class="ml10">开</span>
            </el-form-item>
            <el-form-item label="IOS版本:" prop="app_version" size="mini">
              <el-input v-model="ruleFormIos.app_version" class="w300" />
            </el-form-item>
            <el-form-item label="IOS下载地址:" prop="app_path" size="mini">
              <el-input v-model="ruleFormIos.app_path" class="w300" />
            </el-form-item>
            <el-form-item label="IOS更新日志:" prop="app_log" size="mini">
              <el-input v-model="ruleFormIos.app_log" class="w300" type="textarea" />
            </el-form-item>
          </el-form>
          <div class="tr mt80">
            <el-button size="small" @click="quitSlideIos('ruleFormIos')">重置</el-button>
            <el-button size="small" type="primary" @click="submitFormIos('ruleFormIos')">保存</el-button>
          </div>
        </el-tab-pane>
        <el-tab-pane name="sixth" label="操作日志">
          <el-form class="row" :inline="true" size="mini" :model="searchLog">
            <div style="width: 100%">
              <el-form-item label="操作时间">
                <el-date-picker
                  v-model="dateRange"
                  class="w250"
                  type="daterange"
                  range-separator="至"
                  value-format="yyyy-MM-dd"
                  start-placeholder="开始日期"
                  end-placeholder="结束日期"
                  @change="changeDateRange"
                />
              </el-form-item>
              <el-form-item label="类型">
                <el-select v-model="searchLog.app_type" class="w130" clearable>
                  <el-option v-for="item in options.type_list" :key="item.id" :label="item.name" :value="item.id" />
                </el-select>
              </el-form-item>
              <el-form-item>
                <div class="flex">
                  <el-button type="primary" class="right" @click="setLog('search')">搜索</el-button>
                </div>
              </el-form-item>
            </div>
          </el-form>
          <!--列表-->
          <el-table :data="logList" size="small" :cell-style="$style.cellStyle" :header-cell-style="$style.rowClass">
            <!-- <el-table-column label="序号" width="60" type="index" /> -->
            <el-table-column label="操作时间" width="280" prop="create_time" />
            <el-table-column label="类型" width="160" prop="app_type_name" />
            <!-- <el-table-column label="版本号" width="200" prop="app_version" /> -->
            <el-table-column label="更新内容" prop="app_log" />
          </el-table>
          <!--分页-->
          <pagination
            class="page tc mt10"
            :total="page.total"
            :page.sync="page.page"
            :limit.sync="page.limit"
            @pagination="setLog('')"
          />
        </el-tab-pane>
        <el-tab-pane name="seventh" label="访问配置">
          <div class="tr mb20">
            <el-button size="mini" type="primary" @click="openTrade('添加')">添加业态</el-button>
          </div>
          <el-table
            :data="tradeList"
            size="small"
            height="640"
            :cell-style="$style.cellStyle"
            :header-cell-style="$style.rowClass"
          >
            <ElTableColumn label="业态名称" prop="name">
              <template slot-scope="{ row }">
                <div class="flex_center">
                  <div class="lh30">{{ row.name }}</div>
                  <el-color-picker v-model="row.theme_color" class="ml10" disabled size="mini" />
                </div>
              </template>
            </ElTableColumn>
            <ElTableColumn label="业态标识" prop="sign" width="80" />
            <ElTableColumn label="icon" prop="icon" width="120">
              <template slot-scope="{ row }">
                <el-image class="alsImg" :src="row.icon_path" fit="icon" />

              </template>
            </ElTableColumn>
            <ElTableColumn label="登录logo" prop="login_logo" width="120">
              <template slot-scope="{ row }">
                <el-image class="alsImg" :src="row.login_logo_path" fit="icon" />
              </template>
            </ElTableColumn>
            <ElTableColumn label="网站logo" prop="web_logo" width="120">
              <template slot-scope="{ row }">
                <el-image class="alsImg" :src="row.web_logo_path" fit="icon" />
              </template>
            </ElTableColumn>
            <ElTableColumn label="网站地址" prop="web_domain" />
            <ElTableColumn label="接口地址" prop="api_domain" />
            <ElTableColumn label="操作" width="100">
              <template slot-scope="{ row }">
                <el-button size="mini" type="primary" @click="openTrade('编辑', row)">编 辑</el-button>
              </template>
            </ElTableColumn>
          </el-table>
        </el-tab-pane>
      </el-tabs>
    </el-card>

    <!-- 添加编辑区域弹窗 -->
    <el-dialog :title="`${areaTitle}区域`" width="30%" :visible.sync="dialogVisible" :close-on-click-modal="false">
      <el-form ref="arerForm" :model="arerForm" label-width="90px" :rules="rules">
        <el-form-item label="地区名称:" prop="name">
          <el-input v-model="arerForm.name" placeholder="请输入地区名称" maxlength="50" show-word-limit />
        </el-form-item>
        <el-form-item label="所属上级:">
          <el-input :value="parent_name ? parent_name : '首级'" disabled />
        </el-form-item>
        <el-form-item label="行政编码:" prop="code">
          <el-input v-model="arerForm.code" placeholder="请输入行政编码" maxlength="50" show-word-limit />
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button size="small" @click="dialogVisible = false">取 消</el-button>
        <el-button size="small" type="primary" @click="handleSubmit">确 定</el-button>
      </span>
    </el-dialog>

    <!-- 添加编辑字典弹窗 -->
    <el-dialog :title="`${textType}`" :close-on-click-modal="false" :visible.sync="dialogDict" width="30%">
      <el-form ref="detail" :model="detail" :rules="rulesDict" label-width="100px" size="mini">
        <el-form-item label="所属类型" prop="type">
          <el-select
            v-model="detail.type"
            class="w250"
            :disabled="textType == '编辑'"
            placeholder="请选择所属类型"
            @change="getOptions"
          >
            <el-option v-for="item in options.type" :key="item.id" :label="item.name" :value="item.id" />
          </el-select>
        </el-form-item>
        <el-form-item label="名称" prop="name">
          <el-input v-model="detail.name" class="w250" placeholder="请输入名称" clearable maxlength="20" show-word-limit />
        </el-form-item>
        <el-form-item v-if="detail.type == 5" label="金蝶编码" prop="kingdee_no">
          <el-input v-model="detail.kingdee_no" class="w250" placeholder="请输入金蝶编码" clearable />
        </el-form-item>
        <el-form-item v-if="detail.type != 3" label="所属上级">
          <el-input v-if="textType == '编辑'" v-model="detail.pid_name" disabled class="w250" />
          <el-cascader
            v-else
            v-model="pidList"
            :options="options.pid"
            :props="optionProps"
            class="w250"
            clearable
            @change="changeType"
          />
        </el-form-item>
        <el-form-item label="备注">
          <el-input
            v-model="detail.remark"
            class="w250"
            type="textarea"
            placeholder="请输入备注"
            clearable
            maxlength="50"
            show-word-limit
          />
        </el-form-item>
        <el-form-item label="是否启用">
          <el-radio-group v-model="detail.status">
            <el-radio :label="1">启用</el-radio>
            <el-radio :label="2">禁用</el-radio>
          </el-radio-group>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button size="mini" @click="dialogDict = false">取 消</el-button>
        <el-button size="mini" type="primary" @click="createDetail('detail')">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 添加编辑业态 -->
    <el-dialog
      :title="`${tradeTil}业态`"
      :visible.sync="addTrade"
      :close-on-click-modal="false"
      width="60%"
      :before-close="closeDialog"
    >
      <el-form ref="tradeDetail" :model="tradeDetail" :rules="rulesTrade" label-width="120px" size="mini">
        <div class="flex_sb">
          <el-form-item label="业态名称" prop="name">
            <el-input v-model="tradeDetail.name" class="w250" placeholder="请输入业态名称" clearable maxlength="50" />
          </el-form-item>
          <el-form-item label="业态标识" prop="sign">
            <el-select v-model="tradeDetail.sign" class="w250" placeholder="请选择业态标识">
              <el-option v-for="(item,index) in options.sign_list" :key="index" :label="item.item" :value="item.item" />
            </el-select>
          </el-form-item>
        </div>
        <div class="flex_sb mb20">
          <el-form-item label="网站地址" prop="web_domain">
            <el-input v-model="tradeDetail.web_domain" class="w250" placeholder="请输入网站地址" clearable maxlength="100" />
          </el-form-item>
          <el-form-item label="接口地址" prop="api_domain">
            <el-input v-model="tradeDetail.api_domain" class="w250" placeholder="请输入接口地址" clearable maxlength="100" />
          </el-form-item>
        </div>
        <div class="flex_sb mb20">
          <el-form-item label="icon" prop="icon">
            <img-upload
              v-if="tradeDetail.sign"
              :file-dir="tradeDetail.sign"
              :exist-url="iconUrl"
              @setUrl="(value) => getUrl(value, 'icon')"
            />
          </el-form-item>
          <el-form-item label="登录页logo" prop="login_logo">
            <img-upload
              v-if="tradeDetail.sign"
              :file-dir="tradeDetail.sign"
              :exist-url="loginUrl"
              @setUrl="(value) => getUrl(value, 'login_logo')"
            />
          </el-form-item>
          <el-form-item label="网站logo" prop="web_logo">
            <img-upload
              v-if="tradeDetail.sign"
              :file-dir="tradeDetail.sign"
              :exist-url="webUrl"
              @setUrl="(value) => getUrl(value, 'web_logo')"
            />
          </el-form-item>
        </div>
        <div class="flex_sb mb20">
          <el-form-item label="主题色" prop="theme_color">
            <el-color-picker v-model="tradeDetail.theme_color" size="mini" />
          </el-form-item>
        </div>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <!-- <el-button size="mini" @click="addTrade = false">取 消</el-button> -->
        <el-button size="mini" type="primary" @click="tradeForm('tradeDetail')">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { mapGetters } from 'vuex';
import pagination from '@/components/Pagination';
import imgUpload from '@/components/Upload/imgUploadOne';
import {
  setSite,
  getSite,
  menuAll,
  regionList,
  regionCreate,
  regionUpdate,
  customerDictList,
  customerDictCreate,
  customerDictUpdate,
  androidApp,
  getAndroidApp,
  iosApp,
  getIosApp,
  appUpdateLog,
  webConf,
  webConfCreate,
  webConfUpdate
} from '@/api/config';
// import { dealerDict } from '@/api/dealer';
class FormData {
  mini_kefu = '0'; // 客服功能 0：关闭 1：开启
  qwx_approve = '0'; // 微信审批 0：关闭 1：开启
  qwx_message_push = '0'; // 消息推送 0：关闭 1：开启
  kd = '0'; // 金蝶资料 0：关闭 1：开启
  kd_pt = '0'; // 产品资料 0：关闭 1：同步商品 2: 金蝶对码
  kd_pt_match_code = '0'; //  仓库对码 0：通用账套 1：多账套
  kd_ct = '0'; //   餐饮直销 客户资料 0：关闭 1：CRM推送 2：金蝶对码
  kd_ct_order_push = '0'; //   订单推送 0：关闭 1：开启
  kd_ct_order_push_rule = '0'; //   下推规则 0：创建金蝶销售订单 1：创建并下推至金蝶发货通知单
  kd_ct_order_push_mode = '0'; //   下推方式 0：自动下推 1：人工下推
  kd_ct_order_push_verify_ity = '0'; //   库存校验 0：不校验库存 1：校验库存
  kd_ct_payment_cycle = '0'; //   挂账周期 0：关闭 1：开启
  kd_dl = '0'; //   经销商 客户资料 0：关闭 1：CRM推送 2：金蝶对码
  kd_dl_order_push = '0'; //   订单推送 0：关闭 1：开启
  kd_dl_order_push_rule = '0'; //   下推规则 0：创建金蝶销售订单 1：创建并下推至金蝶发货通知单
  kd_dl_order_push_mode = '0'; //   下推方式 0：自动下推 1：人工下推
  kd_dl_order_push_verify_ity = '0'; //   库存校验 0：不校验库存 1：校验库存
  kd_dl_payment_cycle = '0'; //   挂账周期 0：关闭 1：开启
  pt = '0'; //  经销商 0：关闭 1：直销 2：经销 3：直销和经销
  pt_ct_pricing = '0'; // 餐饮直销 调价 0：关闭 1：开启
  pt_ct_pricing_rule = '0'; // 客户成交规则 0：不校验调价 1：手动创建后可成交 2：自动创建后成交
  pt_ct_pricing_rule_range = ''; // 商品范围 全部 1：自选

  pt_ct_mini = '0'; // 小程序显示规则 0：显示所有 1: 仅显示调价
  pt_ct_order = '0'; // 订单 关闭 1: 开启
  pt_ct_order_cash_delivery = '0'; // 货到付款 关闭 1: 开启-客户需要申请货到付款功能 2：开启-客户自动拥有货到付款功能
  pt_ct_sample = '0'; // 试样 0：不使用发货工厂 1：使用发货工厂
  pt_dl_pricing_rule_range = ''; //  商品范围 0：全部 商品ID：自选
  pt_dl_mini = '0'; //  小程序显示规则 0：显示所有 1：仅显示调价
  pt_dl_sample = '0'; //  试样 0：关闭 1：开启
  pt_dl_order = '0'; //  订单 0：关闭 1：开启
  pt_dl_order_cash_delivery = '0'; //  货到付款 0：关闭 1：开启-申请认证 2：开启-自动认证
  ct = '0'; //  餐饮直销 0：关闭 1：开启
  ct_share_sync = '0'; // 共享同步 0：关闭 1：开启
  ct_share_push = '0'; // 共享推送 0：关闭 1：开启
  dl = '0'; //  经销商 0：关闭 1：开启
  dl_share_sync = '0'; // 共享同步 0：关闭 1：开启
  dl_share_push = '0'; // 共享推送 0：关闭 1：开启
}
class ArerForm {
  name = '';
  code = '';
  id = '';
  parent_id = '';
}
class Rules {
  name = [{ required: true, message: '请填写地区名称', trigger: 'blur' }];
  code = [{ required: true, message: '请填写行政编码', trigger: 'blur' }];
}
class Search {
  name = ''; // 名称
  type = ''; // 类型ID
}
class Options {
  type = [
    { id: 101, name: '客户类型' },
    { id: 102, name: '行业类型' },
    { id: 103, name: '客户来源' }
  ];
  pid = [];
  type_list = [
    { id: 'pc', name: 'PC版本' },
    { id: 'android', name: 'Android版本' },
    { id: 'ios', name: 'IOS版本' },
    { id: 'mini', name: '小程序版本' },
    { id: 'white', name: '白名单' }
  ];
}
class Detail {
  name = '';
  type = '';
  pid = ''; // 上级
  kingdee_no = ''; // 金蝶编码
  status = 1;
  remark = '';
}
class RulesDict {
  type = [{ required: true, message: '请选择所属类型', trigger: 'change' }];
  name = [{ required: true, message: '请输入名称', trigger: 'blur' }];
  kingdee_no = [
    { required: true, message: '请选择金蝶编码', trigger: 'change' }
  ];
  pid = [{ required: true, message: '请选择所属上级', trigger: 'change' }];
}
class RuleForm {
  app_close_status = ''; // app关闭状态1 开0 关
  app_update_status = ''; // 强制更新1 开0 关
  app_close_reason = ''; // 关闭原因
  app_version = ''; // 版本号
  app_path = ''; // 下载地址
  app_log = ''; // 安卓更新日志
}
class FourthRules {
  app_version = [{ required: true, message: '请输入版本号', trigger: 'blur' }];
  app_close_reason = [
    { required: true, message: '请输入关闭原因', trigger: 'blur' }
  ];
  app_path = [{ required: true, message: '请输入下载地址', trigger: 'blur' }];
  app_log = [{ required: true, message: '请输入更新日志', trigger: 'blur' }];
}
class RuleFormIos {
  app_close_status = ''; // app关闭状态1 开0 关
  app_update_status = ''; // 强制更新1 开0 关
  app_close_reason = ''; // 关闭原因
  app_version = ''; // 版本号
  app_log = ''; // IOS更新日志
  app_path = ''; // IOS下载地址
}
class RulesIos {
  app_version = [{ required: true, message: '请输入版本号', trigger: 'blur' }];
  app_close_reason = [
    { required: true, message: '请输入关闭原因', trigger: 'blur' }
  ];
  app_path;
  app_log = [{ required: true, message: '请输入更新日志', trigger: 'blur' }];
  app_path = [{ required: true, message: '请输入下载地址', trigger: 'blur' }];
}
class SearchLog {
  start_time = '';
  end_time = '';
  app_type = '';
}
class Page {
  total = 0;
  page = 1;
  limit = 10;
}
class TradeDetail {
  name = '';
  sign = '';
  web_domain = '';
  api_domain = '';
  icon = '';
  login_logo = '';
  web_logo = '';
  theme_color = '#2c2c2c';
}
class RulesTrade {
  name = [{ required: true, message: '请输入业态名称', trigger: 'blur' }];
  sign = [{ required: true, message: '请选择业态标识', trigger: 'change' }];
  web_domain = [{ required: true, message: '请输入网站地址', trigger: 'blur' }];
  api_domain = [{ required: true, message: '请输入接口地址', trigger: 'blur' }];
  icon = [{ required: true, message: '请选择icon', trigger: 'change' }];
  login_logo = [
    { required: true, message: '请选择登录logo', trigger: 'change' }
  ];
  web_logo = [{ required: true, message: '请选择网站logo', trigger: 'change' }];
  theme_color = [{ required: true, message: '请选择主题色', trigger: 'change' }];
}
export default {
  name: 'Configuration',
  components: {
    pagination,
    imgUpload
  },
  data() {
    return {
      activeName: 'first', // 当前导航
      formData: new FormData(), // 选项
      pt_ct_pricing_rule_range: '0', // 商品范围 餐饮直销
      pt_dl_pricing_rule_range: '0', // 商品范围 经销商
      loading: false,
      list: [], // 列表
      arerForm: new ArerForm(), // 区域管理表单
      rules: new Rules(), // 区域管理表单验证
      dialogVisible: false,
      areaTitle: '',
      parent_name: '',
      dictList: [], // 公共字典
      search: new Search(), // 检索条件
      options: new Options(), // 选项
      textType: '',
      dialogDict: false,
      detail: new Detail(), // 添加/编辑选项
      rulesDict: new RulesDict(), // 添加/编辑选项验证
      optionProps: {
        value: 'id',
        label: 'name',
        checkStrictly: true
      },
      pidList: [],
      ruleForm: new RuleForm(),
      fourthRules: new FourthRules(),
      swichStatus: false, // 是否禁用
      swich: false, // 是否禁用
      ruleFormIos: new RuleFormIos(),
      rulesIos: new RulesIos(),
      swichStatusIos: false, // 是否禁用
      swichIos: false, // 是否禁用
      searchLog: new SearchLog(), // 普通搜索
      logList: [], // 列表
      page: new Page(), // 分页
      dateRange: [], // 日期
      tradeDetail: new TradeDetail(), // 添加/编辑业态选项
      rulesTrade: new RulesTrade(), // 添加/编辑业态验证
      tradeList: [],
      addTrade: false, // 业态弹窗
      tradeTil: '', // 添加、编辑业态
      iconUrl: {}, // 图片回显
      loginUrl: {}, // 图片回显
      webUrl: {}, // 图片回显
      fileDir: ''
    };
  },
  computed: {
    ...mapGetters(['userInfo'])
  },
  mounted() {
    this.getData();
  },
  methods: {
    // 切换导航
    handleClick(tab) {
      switch (tab.name) {
        case 'first':
          this.getData();
          break;
        case 'second':
          this.getList();
          break;
        case 'third':
          this.getdictList();
          break;
        case 'fourth':
          this.getSet();
          break;
        case 'fifth':
          this.getSetIos();
          break;
        case 'sixth':
          this.setLog();
          break;
        case 'seventh':
          this.getWebConf();
          break;
      }
    },
    // ---------------基础配置----------------
    // 获取基础配置信息
    async getData() {
      const { data } = await getSite();
      this.formData = data;
      if (this.formData.pt_ct_pricing_rule_range != 0) {
        this.pt_ct_pricing_rule_range = '1';
      } else {
        this.pt_ct_pricing_rule_range = '0';
      }
      if (this.formData.pt_dl_pricing_rule_range != 0) {
        this.pt_dl_pricing_rule_range = '1';
      } else {
        this.pt_dl_pricing_rule_range = '0';
      }
    },
    // 选择是否所有商品
    changePTCT(e) {
      if (e == 0) {
        this.formData.pt_ct_pricing_rule_range = 0;
      } else {
        this.formData.pt_ct_pricing_rule_range = [];
      }
    },
    // 选择是否所有商品
    changePTDL(e) {
      if (e == 0) {
        this.formData.pt_dl_pricing_rule_range = 0;
      } else {
        this.formData.pt_dl_pricing_rule_range = [];
      }
    },
    // ---------------区域管理----------------
    // 区域列表加载
    async load(tree, treeNode, resolve) {
      const { data } = await regionList({ pid: tree.id });
      if (tree.level < 2) {
        data.forEach((item) => {
          item['children'] = [];
        });
      }
      if (tree.type == 'change') {
        this.list = [];
        this.getList();
      } else {
        resolve(data);
      }
    },
    // 获取区域列表
    async getList() {
      this.loading = true;
      const { data } = await regionList({ pid: 0 });
      data.forEach((item) => {
        item['children'] = [];
      });
      this.list = data;
      this.loading = false;
    },
    // 按钮
    tapBtn(type, row) {
      this.title = type;
      this.areaTitle = type;
      switch (type) {
        case '编辑':
          this.parent_name = row.parent_name;
          this.arerForm.id = row.id;
          this.arerForm.name = row.name;
          this.arerForm.parent_id = row.parent_id;
          this.arerForm.parent_name = row.parent_name;
          this.arerForm.code = row.code;
          this.dialogVisible = true;
          break;
        case '添加':
          this.arerForm = new ArerForm();
          this.parent_name = row.name;
          this.arerForm.parent_id = row.id;
          this.dialogVisible = true;
          break;
      }
    },
    // 区域提交按钮
    handleSubmit() {
      this.$refs.arerForm.validate((valid) => {
        if (valid) {
          let hintText = this.areaTitle == '编辑' ? '编辑此区域' : '添加此区域';
          this.hint('area', hintText);
        }
      });
    },
    // ---------------公共字典----------------
    async getdictList() {
      try {
        let { data } = await customerDictList({ ...this.search });
        this.dictList = data;
      } catch (e) {
        this.dictList = [];
      }
    },
    // 获取选项
    async getOptions(e) {
      this.pidList = [];
      // const { data } = await dealerDict();
      // this.options.pid = data[e];
    },
    // 所属上级改变
    changeType(e) {
      let index = e.length - 1;
      this.detail.pid = e[index];
    },
    // 编辑公共字典
    openDialog(type, row) {
      this.textType = type;
      this.dialogDict = true;
      if (type == '添加') {
        this.detail = new Detail();
      } else {
        this.pidList = [row.pid];
        const { id, pid, pid_name, name, kingdee_no, status, remark, type } =
          row;
        this.detail = {
          id: id,
          pid: pid,
          name: name,
          kingdee_no: kingdee_no,
          pid_name: pid_name,
          status: status,
          remark: remark,
          type: type
        };
      }
    },
    // 提交公共字典
    createDetail(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          let hintText = this.textType == '添加' ? '添加字典' : '更新字典';
          this.hint('dict', hintText);
        } else {
          console.log('error submit!!');
          return false;
        }
      });
    },
    // ---------------Android版本----------------
    async getSet() {
      this.ruleForm = await getAndroidApp();
      this.swichStatus = this.ruleForm.app_close_status == '1';
      this.swich = this.ruleForm.app_update_status == '1';
    },
    // 改变SwichStatus
    changeSwichStatus(e) {
      this.ruleForm.app_close_status = e == true ? '1' : '0';
    },
    // 改变swich
    changeSwich(e) {
      this.ruleForm.app_update_status = e == true ? '1' : '0';
    },
    // 取消
    quitSlide(formName) {
      this.ruleForm = new RuleForm();
      this.$refs[formName] ? this.$refs[formName].resetFields() : '';
    },
    submitFormFourth(formName) {
      // if (this.swichStatus && this.ruleForm.app_close_reason == '') { return this.$message('请输入关闭原因'); }
      this.$refs[formName].validate((valid) => {
        if (valid) {
          this.hint('Android', '提交Android设置信息');
        } else {
          console.log('error submit!!');
          return false;
        }
      });
    },
    // ---------------ios版本----------------
    async getSetIos() {
      this.ruleFormIos = await getIosApp();
      this.swichStatusIos = this.ruleFormIos.app_close_status == '1';
      this.swichIos = this.ruleFormIos.app_update_status == '1';
    },
    // 取消
    quitSlideIos(formName) {
      this.ruleFormIos = new RuleFormIos();
      this.$refs[formName] ? this.$refs[formName].resetFields() : '';
    },
    // 改变SwichStatus
    changeSwichStatusIos(e) {
      this.ruleFormIos.app_close_status = e == true ? '1' : '0';
    },
    // 改变swich
    changeSwichIos(e) {
      this.ruleFormIos.app_update_status = e == true ? '1' : '0';
    },
    submitFormIos(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          this.hint('ios', '提交IOS设置信息');
        } else {
          console.log('error submit!!');
          return false;
        }
      });
    },
    // ---------------操作日志----------------
    // 获取列表
    async setLog(option) {
      if (option === 'search') this.page = new Page();
      try {
        const { list, dataCount } = await appUpdateLog({
          ...this.page,
          ...this.searchLog
        });
        this.logList = list;
        this.page.total = dataCount;
      } catch {
        this.list = [];
        this.page.total = 0;
      }
    },
    // 日期选择
    changeDateRange() {
      this.searchLog.start_time = this.dateRange ? this.dateRange[0] : '';
      this.searchLog.end_time = this.dateRange ? this.dateRange[1] : '';
      // this.getList('search');
    },
    // ---------------访问配置----------------
    async getWebConf() {
      const res = await webConf();
      this.tradeList = res.data.list;
      this.options.sign_list = res.data.sign_list;
    },
    openTrade(type, row) {
      this.addTrade = true;
      this.tradeTil = type;
      switch (type) {
        case '添加':
          this.iconUrl = {};
          this.loginUrl = {};
          this.webUrl = {};
          this.tradeDetail = new TradeDetail();
          break;
        case '编辑':
          // console.log(row);
          this.tradeDetail = row;
          this.iconUrl['absoluteUrl'] = row.icon_path;
          this.iconUrl['relativeUrl'] = row.icon_save_path;
          this.loginUrl['absoluteUrl'] = row.login_logo_path;
          this.loginUrl['relativeUrl'] = row.login_logo_save_path;
          this.webUrl['absoluteUrl'] = row.web_logo_path;
          this.webUrl['relativeUrl'] = row.web_logo_save_path;
          break;
      }
    },
    // 上传小程序用户默认logo
    getUrl(url, type) {
      const { absoluteUrl, relativeUrl } = url;
      switch (type) {
        case 'icon':
          this.tradeDetail.icon = relativeUrl;
          break;
        case 'login_logo':
          this.tradeDetail.login_logo = relativeUrl;
          break;
        case 'web_logo':
          this.tradeDetail.web_logo = relativeUrl;
          break;
      }
    },
    closeDialog() {
      this.addTrade = false;
      this.tradeDetail = new TradeDetail();
      // this.iconUrl = {};
      // this.loginUrl = {};
      // this.webUrl = {};
    },
    // 提交业态
    tradeForm(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          let hintText = this.tradeTil == '添加' ? '添加业态内容' : '更新业态内容';
          this.hint('trade', hintText);
        } else {
          console.log('error submit!!');
          return false;
        }
      });
    },

    // 确认提示
    hint(status, hintText) {
      this.$confirm(`${hintText}, 是否确认?`, '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      })
        .then(() => {
          switch (status) {
            case 'add':
              this.submitForm();
              break;
            case 'update':
              this.updateJurisdiction();
              break;
            case 'area':
              this.confirm();
              break;
            case 'dict':
              this.affirmSubmit();
              break;
            case 'Android':
              this.affirmSubmitFourth();
              break;
            case 'ios':
              this.affirmSubmitIos();
              break;
            case 'trade':
              this.tradeSubmit();
              break;
          }
        })
        .catch(() => {
          this.$message({
            type: 'info',
            message: '已取消'
          });
        });
    },
    // 保存配置
    submitForm() {
      // console.log(this.formData);
      setSite({
        ...this.formData
      }).then((res) => {
        this.$message({
          message: res.msg,
          type: 'success'
        });
        // this.getList();
      });
    },
    // 管理员权限
    async updateJurisdiction() {
      const { msg } = await menuAll();
      this.$message({
        message: msg,
        type: 'success'
      });
    },
    // 添加/更新区域
    async confirm() {
      console.log(this.areaTitle);
      const res =
        this.areaTitle == '添加'
          ? await regionCreate({ ...this.arerForm })
          : await regionUpdate({ ...this.arerForm });
      this.$message({
        type: 'success',
        message: res.msg
      });
      this.dialogVisible = false;
      let tree = {};
      tree.id = this.arerForm.parent_id;
      tree.type = 'change';
      this.load(tree, '', 'resolve');
    },
    // 添加/更新字典
    async affirmSubmit() {
      const res =
        this.textType == '添加'
          ? await customerDictCreate({
            ...this.detail
          })
          : await customerDictUpdate({
            ...this.detail
          });
      this.dialogDict = false;
      this.getdictList();
      this.$notification('操作成功', 'success', res.msg);
    },
    // android更新
    async affirmSubmitFourth() {
      let res = await androidApp({ ...this.ruleForm });
      this.$message({
        message: res.msg,
        type: 'success'
      });
    },
    // ios更新
    async affirmSubmitIos() {
      let res = await iosApp({ ...this.ruleFormIos });
      this.$message({
        message: res.msg,
        type: 'success'
      });
    },

    // 添加/编辑业态
    async tradeSubmit() {
      const res =
        this.tradeTil == '添加'
          ? await webConfCreate({
            ...this.tradeDetail
          })
          : await webConfUpdate({
            ...this.tradeDetail
          });
      this.addTrade = false;
      this.getWebConf();
      this.$notification('操作成功', 'success', res.msg);
    }
  }
};
</script>

<style scoped lang="scss">
.container {
  margin: 0 auto;
}
.info {
  width: 1200px;
  height: 100%;
  overflow-y: scroll;
}
.title {
  border-left: 3px solid #8b2e2f;
  padding-left: 10px;
  margin-bottom: 20px;
  margin-top: 10px;
  font-weight: bold;
  font-size: 18px;
  line-height: 16px;
}
.titleQ {
  margin-bottom: 10px;
  margin-top: 10px;
  font-weight: bold;
  font-size: 16px;
  line-height: 16px;
  span {
    color: #8b2e2f;
    font-size: 28px;
  }
  .spanS {
    color: #8b2e2f;
    font-size: 16px;
  }
}
.titleQ2 {
  font-size: 14px;
}
.dialog-footer {
  text-align: right;
  margin: 50px 0;
}
.alsImg {
  width: 40px;
  height: 40px;
  border-radius: 6px;
}
::v-deep .cell {
  display: flex;
  justify-content: center;
}
::v-deep .el-color-picker--mini .el-color-picker__trigger {
  width: 60px;
}
</style>
